package com.happyscan138.makefun.base;

import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;

/**
 * Created by Administrator on 2017/2/22.
 */

class MyClick implements View.OnClickListener, VideoPlayView.MediaPlayerImpl {
    private int position;
    private VideoPlayView playView;
    private FrameLayout show_layout;
    private View convertView;
    private boolean isPlaying;
    private int currentPosition = -1;
    private String url;
    private View currentItemView;

    public MyClick(int position, VideoPlayView playView, FrameLayout show_layout, View convertView,String url,View currentItemView) {
        this.position = position;
        this.show_layout = show_layout;
        this.playView = playView;
        this.convertView = convertView;
        this.url=url;
        this.currentItemView=currentItemView;
    }

    @Override
    public void onClick(View v) {
        isPlaying = true;
        currentPosition = position;
        show_layout.setVisibility(View.GONE);
        playView.setUrl(url);
        currentItemView = convertView;
        setPlayView(playView);
        playView.openVideo();
    }

    public void setPlayView(VideoPlayView playView) {
        this.playView = playView;
        playView.setMediaPlayerListenr(this);
        int[] curr = new int[2];
        currentItemView.getLocationOnScreen(curr);
        Log.i("TAG", curr[1] + "");
    }

    @Override
    public void onError() {

    }

    @Override
    public void onExpend() {

    }

    @Override
    public void onShrik() {

    }
}